
# 强制转换成字符串
print(str(1))

# 强制转换成元组
print(tuple('abc'))
print(tuple(['a', 'b', 'c']))
print(tuple({'a', 'b', 'c'}))
# 强制转换成列表
print(list('abc'))
print(list(('a', 'b', 'c')))
print(list({'a', 'b', 'c'}))

# 强制转换成集合
print(set('abcb'))
print(set(['a', 'b', 'c']))
print(set(('a', 'b', 'c')))

# 强制转换成bool
print(bool(''))
print(bool(()))
print(bool([]))
print(bool({}))
print(bool(set()))
print(bool(0))
print(bool(0.0))

# 强制转换成字典
print(dict([[(1,2),2], 'bc', ('a', 1)]))
# 强制转换成整数
print(int("15"))
print(int(1.5))
# 强制转换成浮点型
print(float(10))
print(float('10'))
print(float('10.9'))
# 类型查看
print(type({1,2}))
# range  获取range对象
print(list(range(1,10)))

# slice  切片对象
a = slice(0, 2)
print(['a', 'b', 'c', 'd'][a])


